﻿using BDPAutodetect.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BDPAutodetect.Client
{
    /// <summary>
    /// ParameterView.xaml 的交互逻辑
    /// </summary>
    public partial class ParameterView : UserControl, ITransferView<UserControl>
    {
        /// <summary>
        /// 数据模型服务
        /// </summary>
        public BaseViewModel<UserControl>? ModelService { get; set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="modelService">数据模型服务</param>
        public ParameterView(ParameterViewModel modelService)
        {
            InitializeComponent();
            this.ModelService = modelService;
            this.ModelService?.RegisterParent(this);
            this.DataContext = this.ModelService;
        }

        /// <summary>
        /// 页面跳转传输数据
        /// </summary>
        /// <typeparam name="TData">泛型</typeparam>
        /// <param name="argData">传递数据</param>     
        public void TransferData<TData>(TData argData) where TData : class, new()
        {
            this.ModelService?.TransferChangeData(argData);
        }

        /// <summary>
        /// 传输权限许可信息
        /// </summary>
        public void TransferPowerPermission(MPowerPermission argPowerPermission)
        {
            this.ModelService?.TransferPowerPermission(argPowerPermission);
        }
    }
}
